package com.gxa.saas.service.impl;

import com.gxa.saas.mapper.MeasureMapper;
import com.gxa.saas.pojo.Measure;
import com.gxa.saas.service.MeasureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @Author: yx
 * @Date: 2022/6/8 14:33
 */
@Service("measureService")
public class MeasureServiceImpl implements MeasureService {

    @Autowired
    MeasureMapper measureMapper;

    @Override
    public List<Measure> selectAll() {
        return measureMapper.selectAll();
    }

    @Override
    public Integer selectAllNumber() {
        return measureMapper.selectAllNumber();
    }

    @Override
    public List<Measure> selectByPage(Integer offset) {
        return measureMapper.selectByPage((offset-1)*10, 10);
    }

    @Override
    public void insert(Measure measure) {
        measureMapper.insert(measure);
    }

    @Override
    public void update(Measure measure) {
        measureMapper.update(measure);
    }

    @Override
    public void delete(Integer id) {
        measureMapper.delete(id);
    }

    @Override
    public void updateIsUsed(Integer id, Boolean isUsed) {
        Measure measure = new Measure();
        measure.setId(id);
        measure.setIsUsed(isUsed);
        measureMapper.updateIsUsed(measure);
    }
}
